<template>
	<view class="hui">

        <view class="tab">
			<view class="tab_box">
				<u-search @search="getList" v-model="params.name" bg-color='white' :clearabled="true"  :show-action="false" placeholder="请输入小区名称" ></u-search>
			</view>
		</view>
		
		<view class="list_box">
			<view @click="to(item)" class="info" v-for="(item,index) in list" :key="index" >
				<view class="">{{item.name}}</view>
			</view>
		</view>
		
		<view class="bitmap" v-if="emptyShow">
			<image :src="none" mode="aspectFit"></image>
			<view class="gray_font fs-13">
				暂无小区
			</view>
		</view>

	</view>
</template>

<script>
	export default {
		data() {
			return {	
				params: {
					page: 1,
					limit: 10,
					name:''
				},
				list: [],
				total: 0,
				emptyShow: false,
				none:''
			}
		},
		onLoad(e) {
			this.none=this.$imgUrl+'assets/img/no_content.png';
			this.getList();
		},
		methods: {
			to(e){
				uni.$emit('plot',e);
				uni.navigateBack();
			},
			getList() {
				this.params.page = 1;
				this.$get(this.$api.plotLists, this.params, res => {
					let data = res.data;

					if (!data.data.data || data.data.data.length < 1) {
						this.emptyShow = true;
					} else {
						this.emptyShow = false;
					}

					this.list = data.data.data;
					this.total = data.data.total;
				});
			},
			onReachBottom() {
				if (this.list.length < this.total) {
					this.params.page++;
					this.$get(this.$api.plotLists, this.params, res => {
						let data = res.data;
						data.data.data.forEach(ress => {
							this.list.push(ress);
						});
					});
				}
			},
		}
	}
</script>

<style lang="scss" scoped>
	
	::v-deep{
		.u-content{
			border-radius: 15rpx !important;
		}
	}
	
	.tab{
		box-sizing: border-box;
		padding: 0 30rpx;
	}
	
	.tab_box{
		box-sizing: border-box;
		padding:5rpx 0;
		background-color: white;
		border-radius: 15rpx;
	}
	
	.hui{
		min-height: 100vh;
		background-color: #F0F0F0;
		box-sizing: border-box;
		padding:30rpx 0rpx;
	}
	
	/deep/ .u-tab-item {
		background-color: transparent !important;
		font-size: 30rpx !important;
	}
	
	.list_box {
		box-sizing: border-box;
		padding:30rpx 0rpx 0rpx 0;
	}

	.info {
		//margin-bottom: 30rpx;
		background-color:#F9F9F9;
	    box-sizing: border-box;
	    padding:25rpx ;
	    border-bottom: 1rpx solid #E2E2E2;
	}

     .name{
		 color: black;
		 font-weight: bold;
		 box-sizing: border-box;
		 padding: 0 0 20rpx 15rpx;
		 border-bottom: 1rpx solid #E2E2E2;
	 }
	.time{
		color: #7F7D7E;
		font-size: 26rpx;	
		box-sizing: border-box;
		padding: 20rpx 0 0rpx 15rpx;
		display: flex;
		align-items: center;
		justify-content: space-between;
	}
	.gd{
		font-size: 30rpx;
	}
	.bitmap {
		margin-top: 10vh;
		text-align: center;
	}
	.f_s{
		display: flex;
		
		justify-content: space-between;
	}
	.f_c_s{
		display: flex;
		align-items: center;
		justify-content: space-between;
	}
</style>